package com.leyou.contrlloer;

import com.leyou.domian.Item;
import com.leyou.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping
@RestController  //返回的是数据，不加返回的是页面
public class ItemController {
    @Autowired
    ItemService itemService;

    @GetMapping("/item")
    public ResponseEntity<Item> saveItem(Item item) {
        Item result = itemService.select(item);
        return ResponseEntity.status(HttpStatus.CREATED).body(result);
    }

}
